import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/paper'
import Home from '../views/login'

// 解决ElementUI导航栏中的vue-router在3.0版本以上重复点菜单报错问题
const originalReplace = VueRouter.prototype.replace
VueRouter.prototype.replace = function replace (location) {
  return originalReplace.call(this, location).catch(err => err)
}
Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/3dView',
    name: '3dView',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/3dView.vue')
  },
  {
    path: '/paper',
    name: 'paper',
    component: () => import('../views/paper')
  },
  {
    path: '/paper2',
    name: 'paper2',
    component: () => import('../views/paper2')
  },
  {
    path: '/test',
    name: 'test',
    component: () => import('../views/testTree')
  },
  {
    path: '/page2',
    name: 'page2',
    component: () => import('../views/3dView')
  },
  {
    path: '/search',
    name: 'search',
    component: () => import('../views/search')
  }
]

const router = new VueRouter({
  routes
})
export default router
